export default class Tips {
  // 操作提示框
  static toast(title, callback, icon = 'none') {
    setTimeout(() => {
      uni.showToast({
        title: title,
        icon: icon,
        mask: true,
        duration: 1500
      });
    }, 200);
    if (callback && isFunction(callback)) {
      setTimeout(() => {
        callback();
      }, 1500);
    }
  };
  
 
 // 弹出确认窗口
 
  static confirm(content, title = '提示', options = {}) {
    return new Promise((resolve, reject) => {
      uni.showModal({
        title: title,
        content: content,
        // showCancel: true,
        success: res => {
          if (res.confirm) {
            resolve(options);
          } else if (res.cancel) {
            reject(options);
          }
        },
        fail: res => {
          reject(options);
        }
      });
    }).catch(function(reason) {
      // console.log('catch:', reason);
    });
  }
  
  }